<?php

class Core_Model_Design_Collection_Page_Theme extends Dcmp_Model_Collection_Strong {

    public function __construct() {
        parent::__construct();
        $this->setItemClass('design/page_theme');
        $this->from('{t}design_page_theme', 'a')->field('a.*');
    }

    public function filterBy($name, $arg) {
        switch ($name) {
            case 'id':
                return $this->addParameter('id', $arg)->eq('a.id', ':id:s');
            case 'name':
                return $this->addParameter('name', "%$arg%")->like('a.name', ':name:s');
            case 'areaid':
                return $this->addParameter('areaId', $arg)->eq('a.area_id', ':areaId:s');
            case 'type':
                return $this->addParameter('type', $arg)->eq('a.type', ':type:s');
        }
        return parent::filterBy($name, $arg);
    }
}

